package com.zlq.cn.controller.sign.movie;


import com.zlq.cn.api.SignApiResult;
import com.zlq.cn.dto.vo.SignCommonParam;
import com.zlq.cn.entity.Movie;
import com.zlq.cn.entity.MovieCategory;
import com.zlq.cn.service.movie.MovieCategoryService;
import com.zlq.cn.service.movie.MovieService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * <p>
 * 影片分类 前端控制器
 * </p>
 *
 * @author zhoucl
 * @since 2022-03-19
 */
@Api(tags = "影片-分类")
@RestController
@RequestMapping("/movie/category")
public class MovieCategoryController {

    @Resource
    private MovieCategoryService movieCategoryService;

    @Resource
    private MovieService movieService;

    @ApiOperation("影片分类")
    @PostMapping("/list")
    public SignApiResult<List<MovieCategory>> list(@RequestBody SignCommonParam commonParam) {
        return SignApiResult.resultSuccess(movieCategoryService
                .lambdaQuery()
                .eq(MovieCategory::getStatus, 1)
                .list());
    }

    @ApiOperation("影片加分类列表")
    @PostMapping("/list/category/movie")
    public SignApiResult<List<MovieCategory>> listCategoryMovie(@RequestBody SignCommonParam commonParam) {
        return SignApiResult.resultSuccess(movieService.listCategoryMovie());
    }
}

